﻿using System;
using System.IO;
using System.Text;

namespace XospitalParser
{
    internal class LogReader
    {
        public void ReadAndProcess(string filePath, Action<int, String> processLine)
        {
            using (var streamReader = new StreamReader(filePath, Encoding.GetEncoding(1251)))
            {
                int i = 0;
                while (streamReader.Peek() >= 0)
                {
                    string readLine = streamReader.ReadLine();
                    if (readLine != null && !readLine.StartsWith(" "))
                        processLine(i, readLine);
                    ++i;
                }
            }
        }
    }
}